<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>事件绑定</title>
</head>

<body>
    <input type="button" id="btn1" value="事件绑定1" onclick="on()">
    <input type="button" id="btn2" value="事件绑定2">
</body>
<script>
    function on() {
        alert("按钮1被点击了...");
    }

    document.getElementById('btn2').onclick=function(){
        alert("按钮2被点击了...");
    }


</script>


</html>